Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor AXFR code #92

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

nemanja-zivkovic-atomia
Copy link
Contributor

Refactored AXFR code to not use domainmetadata_change table anymore.
Added new trigger and new trigger function on domainmetadata.
Added TSIG key handling trough change and slavezone_change tables.
Added GetChangedZonesBatchWithTSIG and GetChangedSlaveZonesWithTSIG.
Added a new return type changedzonewithtsig.
Other minor changes.

Partially resolves PROD-2760 (1/2).

Refactored AXFR code to not use domainmetadata_change table anymore.
Added new trigger and new trigger function on domainmetadata.
Added TSIG key handling trough change and slavezone_change tables.
Added GetChangedZonesBatchWithTSIG and GetChangedSlaveZonesWithTSIG.
Added a new return type changedzonewithtsig.
Other minor changes.

Partially resolves PROD-2760 (1/2).
Improved GetChangedZonesBatchWithTSIG SQL performance by 18%.

Amends PROD-2760.
INNER JOIN nameserver ON nameserver_id = nameserver.id
INNER JOIN slavezone ON zone = slavezone.name LEFT JOIN domainmetadata ON slavezone.id = domainmetadata.domain_id AND domainmetadata.kind = 'slave'
WHERE nameserver.name = nameservername AND status = 'PENDING'
ORDER BY changetime ASC, slavezone_change.id ASC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After calling DeleteSlaveZone, the zone is removed from the slave zone table and there is an entry in the 'slavezone_change' table. However, this function doesn't return the change. This is probably because of INNER JOIN slavezone ON zone = slavezone.name, the slave zone doesn't exist.

WHERE nameserver.name = nameservername AND status = 'PENDING'
GROUP BY zone
LIMIT changelimit) AS res
INNER JOIN zone ON res.zone = zone.name LEFT JOIN domainmetadata ON zone.id = domainmetadata.domain_id AND domainmetadata.kind = 'master'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the same as above.

Fixed join issue with GetChangedZonesBatchWithTSIG and
GetChangedSlaveZonesWithTSIG functions where they would not fetch
rows if zone was deleted.

Amends PROD-2760.
@@ -1,12 +1,12 @@
CREATE OR REPLACE FUNCTION AssignTSIGKey(
domain varchar,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nemanja-zivkovic-atomia It is possible to assign the tsig key that doesn't exist from atomiadns. This is not a valid situation from HCP. I am not sure if this should be fixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible, only trough AtomiaDNS. It is not possible trough HCP.

@sasa-mladenovic-troxo I don't remember if we discussed this, but should we prevent this situation? We can do so by adding a foreign key in domainmetadata on tsigkey table.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be allowed on PowerDNS as well. I'm fine to leave it like this for now.

Refactored bind syncer slave zones.

Amends PROD-2760.
Renamed the property for tsig keys

Amends PROD-2760.
This issue can happen because we are still doing
reload_updated_domainmetadata (for backward compatibility)
and because we are not creating the table during clean install
(as we shouldn't).
reload_updated_domainmetadata calls GetChangedDomainIDs which reads
from domainmetadata_change which may not exist.
# Conflicts:
#	server/debian/atomiadns-database.postinst
#	server/generate_wsdl.sh
#	server/schema/ddl.sql
#	server/schema/unassigntsigkey.sql
#	server/wsdl-atomiadns.wsdl
#	server/wsdl-type-schema.xsd
Update AXFR refactor to be backwards compatible and compatible with
a minor release.
Reverted AssignTSIGKey function to include kind parameter to enable
backwards compatibility.
Changed "use_tsig_keys" config to "disable_tsig_keys" in PowerDNS
syncer and inverted the condition so that it doesn't disable
TSIG keys by default.
Changed "use_tsig_keys_for_slave_zones" to "disable_tsig_keys" in
bind syncer to be consistent with PowerDNS syncer and so that it
doesn't disable TSIG keys by default.
Removed use_tsig_keys_for_slave_zones function as it's no longer needed.
Improved exception handling of assign_tsig_key syncer function.
Removed "use_tsig_keys" from the config file.

Amends PROD-2760
Split functions GetChangedZonesBatchWithTSIG and
GetChangedSlaveZonesWithTSIG to fetch zones/slavezones separate
from TSIG keys.

Amends PROD-2760
Split functions GetChangedZonesBatchWithTSIG and
GetChangedSlaveZonesWithTSIG to fetch zones/slavezones separate
from TSIG keys in bindsync.

Amends PROD-2760
Renamed functions for handling tsig key assignment fetch:
atomiaTSIGKeyList -> atomiaTSIGKeyAssignmentList
atomiaTSIGKeyItem -> atomiaTSIGKeyAssignmentItem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants